package patternmining.model.construction;

/** Constants for the possible predicate types in the BPSL formalism.
 *
 * @author Holger
 */
enum BPSLPredicateType {
    
    DefinedIn ("Defined-in"),
    ReferenceToOne ("Reference-to-one"),
    ReferenceToMany ("Reference-to-many"),
    Inheritance ("Inheritance"),
    Creation ("Creation"),
    Invocation ("Invocation"),
    Argument ("Argument"),
    ReturnType ("Return-type");
    
    private final String literal;
    
   BPSLPredicateType(String literal){
       this.literal = literal;
   }
   
   public String getLiteral(){
       return literal;
   }
   
   public static BPSLPredicateType getEnum(String literal) throws IllegalArgumentException{
       BPSLPredicateType pred = null;
       if (literal.equals("Defined-in"))  pred = DefinedIn;
       else if (literal.equals("Reference-to-one")) pred = ReferenceToOne;
       else if (literal.equals("Reference-to-many")) pred = ReferenceToMany;
       else if (literal.equals("Inheritance")) pred = Inheritance;
       else if (literal.equals("Creation")) pred = Creation;
       else if (literal.equals("Invocation")) pred = Invocation;
       else if (literal.equals("Argument")) pred = Argument;
       else if (literal.equals("Return-type")) pred = ReturnType;
       else throw new IllegalArgumentException("No predicate with name \"" + literal + "\" defined." );
       return pred;
   }
   
}
